package com.handle.day02.controller;

import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimerTask;


public class Demo2 extends TimerTask {

    int count = 0;

    @Test
    @Override
    public void run() {
        SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date();
        if(count != 3){
            System.out.println(dd.format(date));
            count++;
        }else {
            System.out.println("aaaa");
            cancel();
        }
    }
}
